# 建立 python 3.11.0环境
FROM python:3.11.0

MAINTAINER AKW

RUN mkdir ~/.pip
RUN echo "[global]" > ~/.pip/pip.conf
RUN echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> ~/.pip/pip.conf

# 容器内创建 myproject 文件夹
ENV APP_HOME=/var/backend
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME

# 将当前目录加入到工作目录中（. 表示当前目录）
ADD ./requirements.txt $APP_HOME

# 更新pip版本
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN apt install gcc g++ \
  && python -m pip install --upgrade pip \
  && pip install -r requirements.txt \
  && pip install gunicorn
COPY . .
EXPOSE 8000
CMD ["/bin/sh", "/var/backend/start.local.bat"]